<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="apple-itunes-app" content="app-id=591578609">
<meta name="viewport" content="width=device-width"/>
<meta name="description" content="筑学堂网校" />
<meta name="keywords" content="筑学堂网校、建筑、考试"/>
<link href="${image.server}/images/favicon.ico" type="image/x-icon" rel="shortcut icon" />
<link rel="stylesheet" type="text/css" href="${csspath}/style/share/style.css">
<link rel="stylesheet" type="text/css" href="${csspath}/style/share/h_index.css">
<link rel="stylesheet" type="text/css" href="${csspath}/style/share/home_style.css">
<link rel="stylesheet" type="text/css" href="${csspath}/style/share/alxx.css">
<link rel="stylesheet" type="text/css" href="${csspath}/style/share/kczx.css">
<link rel="stylesheet" type="text/css" href="${csspath}/style/share/zyzx.css">
<link rel="stylesheet" type="text/css" href="${csspath}/style/share/zyzx_more.css">
<link rel="stylesheet" type="text/css" href="${csspath}/style/share/tab.css">

<!--[if IE 7]>
<link rel="stylesheet" href="/css/font-awesome/css/font-awesome-ie7.min.css">
<![endif]-->

<script type="text/javascript" src="${jspath}/js/share/m.js"></script>
<script src="${jspath}/js/jquery-1.11.1.js" type="text/javascript"></script>
<script src="${jspath}/js/jquery.slideBox.min.js" type="text/javascript"></script>
<script type="text/javascript" src="${jspath}/js/share/tabs.js"></script>
<title>筑学堂家园</title>
<style type="text/css">
a {
	color:#111;
	text-decoration:none;
}
a:link {
	text-decoration:none;
}
a:visited {
	text-decoration:none;
}
a:hover {
	text-decoration:none;
}
a:active {
	text-decoration:none;
}
</style>
</head>
<body style="align:center; padding:0;margin:0;clear:both;">
<%@ include file="share_head.jsp" %>
<div class="zyzx_xx_div">
	<div class="zyzx_more_divt01" style="border-bottom:2px solid #578429;"> <br/>
		<a href="#"><span class="kczx_text01">您的位置：首页>资源中心>${resource.topic}</span> </a> </div>
	<div class="zyzx_more_divt">
		<div class="zyzx_more_left">
			<div class="zyzx_more_tab1">
				<table style="width:740px;height:auto;text-align:left;" >
					<tr>
						<td height="80px" colspan="2" style="font-size:16px;font-weight:bold;" valign="center"> <a href="javascript:void(0);" onclick="downResource();"> <img src="${image.server}/images/share/zyzx_images/${fn:toLowerCase(resource.file_type)}.png"/> ${resource.topic} </a> </td>
					</tr>
					<tr height="35px" style="border-bottom:1px solid #DDD;font-size:12px;" valign="center">
						<td width="350px" > 上传人：${resource.author_name} </td>
						<td width="350px" style="font-size:12px; border-bottom:1px solid #DDD;" > 上传于： <fmt:formatDate value="${resource.create_time}" pattern="yyyy-MM-dd,HH:mm"/> </td>
					</tr>
					<tr height="35px" style="border-bottom:1px solid #DDD;font-size:12px;" valign="center">
						<td width="350px" > 大小：<fmt:formatNumber type="number" value="${resource.file_size/1024.0/1024.0}" pattern="#.##" />M </td>
						<td width="350px" style="font-size:12px; border-bottom:1px solid #DDD;"> 下载积分：  ${resource.need_integral} </td>
					</tr>
					<tr height="35px" style="border-bottom:1px solid #DDD;font-size:12px;" valign="center">
						<td width="350px" > 浏览： ${resource.view_cnt} </td>
						<td width="350px" style="font-size:12px; border-bottom:1px solid #DDD;"> 下载： ${resource.down_cnt} </td>
					</tr>
					<tr height="35px" style="border-bottom:1px solid #DDD;font-size:12px;" valign="center">
						<td width="350px" > 本周下载： 0 </td>
						<td width="350px" style="font-size:12px; border-bottom:1px solid #DDD;"> 更新日期：<fmt:formatDate value="${resource.update_time}" pattern="yyyy-MM-dd,HH:mm"/> </td>
					</tr>
					<tr height="80px" style="border-bottom:1px solid #DDD;font-size:12px;" valign="center">
						<td width="350px" > <img src="${image.server}/images/share/zyzx_images/xing.png"/> </td>
						<td width="350px" style="font-size:12px; border-bottom:1px solid #DDD; text-align:right;"> <a href="javascript:void(0);" id="d_r_now"> <img src="${image.server}/images/share/zyzx_images/ljxz.png"/> </a>&nbsp;&nbsp;&nbsp;&nbsp; </td>
					</tr>
					<tr>
						<td height="35px" colspan="2" style="font-size:12px;font-weight:bold;" valign="center"> 最近下载过此文件的人 </td>
					</tr>
					<tr style="border-bottom:1px solid #DDD;font-size:12px;">
						<td height="40px" colspan="2" style="font-size:12px;font-weight:bold;" valign="center">
							<c:forEach items="${downUserList}" var="item">
								<div class="home_divtmrt0101" style="height:110px;padding-right:5px;"> <a href="#"> <img src="${drmFilePath}cdrmimg/${item.user_himg}?w=80&h=80"></a> <a hrfe="#">
								<p class="home_text04" style="text-align:center">${item.user_lnm }</p>
								</a> </div>								
							</c:forEach>
							<!-- <div class="home_divtmrt0101" style="height:110px;"> <a href="#"> <img src="${image.server}/images/share/home_images/home_people01.jpg"></a> <a hrfe="#">
								<p class="home_text04" style="text-align:center">杨玉芳</p>
								</a> </div> -->
						</td>
					</tr>
				</table>
			</div>
			<div style="width:100%;height:auto;display:block;overflow:hidden;padding:50px;">
				<style type="text/css">
*{margin:0;padding:0;list-style-type:none;}
a,img{border:0;}
body{font:12px/180% Arial, Helvetica, sans-serif , "新宋体";}
/* sitelogo */
li{ list-style:none }
#sitelogo{position:relative;float:left;margin:5px auto;width:330px;height:30px;}
#sitelogo span{display:block;float:left;}
#sitelogo img{padding:2px;}
#sitelogo a:hover img{padding:2px;}
/* sitelogo ul */
#sitelogo ul{display:block;float:left;width:100px;height:28px;position:relative;background: url('${image.server}/images/starrating.gif') top left repeat-x;}
#sitelogo ul li{float:left;}
#sitelogo ul li a{display:block;width:10px;height:28px;text-indent:-9000px;z-index:20;position:absolute;overflow:hidden;}
#sitelogo ul li a:hover{background:url('${image.server}/images/starrating.gif') left 35px;z-index:2;left:0;}
#sitelogo ul a.star1{left:0px;}
#sitelogo ul a.star1:hover{width:10px;}
#sitelogo ul a.star2{left:10px;}
#sitelogo ul a.star2:hover{width:20px;}
#sitelogo ul a.star3{left:20px;}
#sitelogo ul a.star3:hover{width:30px;}
#sitelogo ul a.star4{left:30px;}
#sitelogo ul a.star4:hover{width:40px;}
#sitelogo ul a.star5{left:40px;}
#sitelogo ul a.star5:hover{width:50px;}
#sitelogo ul a.star6{left:50px;}
#sitelogo ul a.star6:hover{width:60px;}
#sitelogo ul a.star7{left:60px;}
#sitelogo ul a.star7:hover{width:70px;}
#sitelogo ul a.star8{left:70px;}
#sitelogo ul a.star8:hover{width:80px;}
#sitelogo ul a.star9{left:80px;}
#sitelogo ul a.star9:hover{width:90px;}
#sitelogo ul a.star10{left:90px;}
#sitelogo ul a.star10:hover{width:100px;}
#currentrating{background:url('${image.server}/images/starrating.gif') left bottom;position:absolute;height:21px;width:0;display:block;text-indent:-9000px;z-index:1;}
#sitelogo #pftip{position:absolute;left:168px;width:200px;color:#999;font-size:14px;}
#sitelogo #pfno{width:40px;color:green;font-family:Arial;font-weight:bold;font-size:14px;}
#sitelogo p{width:110px;float:left;color:#666;}
#sitelogo p span{font-family:Arial;font-style:italic;color:#f60;}
#sitelogo #pfshi{font-size:32px;line-height:28px;font-weight:bold;}
#sitelogo #pfge{font-size:18px;line-height:22px;}
#sitelogo p span.no{width:110px;clear:both;color:#666;font-style:normal;font-size:12px;}
</style>
				<div id="sitelogo">
					<ul class="starrating">
						<li id="currentrating"></li>
						<li><a onMouseOver="infen(1)" onMouseOut="infen(0)" onclick="commentStarLevel(1);" class="star1">1</a></li>
						<li><a onMouseOver="infen(2)" onMouseOut="infen(0)" onclick="commentStarLevel(2);" class="star2">2</a></li>
						<li><a onMouseOver="infen(3)" onMouseOut="infen(0)" onclick="commentStarLevel(3);" class="star3">3</a></li>
						<li><a onMouseOver="infen(4)" onMouseOut="infen(0)" onclick="commentStarLevel(4);" class="star4">4</a></li>
						<li><a onMouseOver="infen(5)" onMouseOut="infen(0)" onclick="commentStarLevel(5);" class="star5">5</a></li>
						<li><a onMouseOver="infen(6)" onMouseOut="infen(0)" onclick="commentStarLevel(6);" class="star6">6</a></li>
						<li><a onMouseOver="infen(7)" onMouseOut="infen(0)" onclick="commentStarLevel(7);" class="star7">7</a></li>
						<li><a onMouseOver="infen(8)" onMouseOut="infen(0)" onclick="commentStarLevel(8);" class="star8">8</a></li>
						<li><a onMouseOver="infen(9)" onMouseOut="infen(0)" onclick="commentStarLevel(9);" class="star9">9</a></li>
						<li><a onMouseOver="infen(10)" onMouseOut="infen(0)" onclick="commentStarLevel(10);" class="star10">10</a></li>
					</ul>
					<span id="pftip"></span> <span id="pfno"></span> </div>
				<div class="tab301">
					<input type="text" style="width:700px;height:100px;padding:0px;" id="comment_input"/>
					<div class="tab302"> 您可以输入200字 <a href="javascript:void(0);" id="publish_comment_a"><img src="${image.server}/images/share/kczx_son/pl01.jpg"/></a> </div>
				</div>
				<div class="tab303"> <a href="#" onMouseDown="tab300(1,4);">
					<div id="tab0301" class="tab30301"> 全部 </div>
					</a> <a  href="#" onMouseDown="tab300(2,4);" >
					<div id="tab0302" class="tab30301" style="background-color:#E2EFFC;border:1px solid #E2EFFC"> 好评 </div>
					</a> <a href="#" onMouseDown="tab300(3,4);">
					<div id="tab0303" class="tab30301" style="background-color:#E2EFFC;border:1px solid #E2EFFC"> 中评 </div>
					</a> <a href="#" onMouseDown="tab300(4,4);">
					<div id="tab0304" class="tab30301" style="background-color:#E2EFFC;border:1px solid #E2EFFC"> 差评 </div>
					</a> </div>
				<div id="tab3001" class="tab300"></div>
				<div id="tab3002" class="tab300" style="display:none"></div>
				<div id="tab3003" class="tab300" style="display:none"></div>
				<div id="tab3004" class="tab300" style="display:none"></div>
			</div>
		</div>
		<div class="zyzx_div_right"> <a href="#">
			<div class="alxx_div_righttb" style="font-size:14px;font-weight:blod;color:#111"> 上&nbsp;传&nbsp;资&nbsp;源</div>
			</a>
			<div class="zyzx_div_rightt">
				<div class="alxx_div_righttbt"> <span class="alxx_div_righttl" > 案例分享达人</span> <a href="javascript:void(0);" onClick="expertNext();"><span class="alxx_div_righttr"> 换一批</span></a> </div>
				<div id="fxtab01" style="width:100%;height:auto;display:block;">
					<table style="width:230px;" id="share_expert_table">
						<c:forEach items="${shareExpertList}" var="item">
							<tr height="70px">
								<td width="60px"> <a href="#"><img src="${drmFilePath}cdrmimg/${item.user_himg}?w=50&h=50" ></a> </td>
								<td  valign="top"> <a href="#" >
									<p class="retext05">${item.user_lnm} </p>
									</a> 综合积分：${item.user_integral} </td>
							</tr>
						</c:forEach>
					</table>
				</div>				
			</div>
		</div>
	</div>
</div>
<%@ include file="share_buttom.jsp" %>
<script type="text/javascript">
Date.prototype.format =function(format)
{
var o = {
"M+" : this.getMonth()+1, //month
"d+" : this.getDate(), //day
"h+" : this.getHours(), //hour
"m+" : this.getMinutes(), //minute
"s+" : this.getSeconds(), //second
"q+" : Math.floor((this.getMonth()+3)/3), //quarter
"S" : this.getMilliseconds() //millisecond
}
if(/(y+)/.test(format)) format=format.replace(RegExp.$1,
(this.getFullYear()+"").substr(4- RegExp.$1.length));
for(var k in o)if(new RegExp("("+ k +")").test(format))
format = format.replace(RegExp.$1,
RegExp.$1.length==1? o[k] :
("00"+ o[k]).substr((""+ o[k]).length));
return format;
}

var globalVar = {
	expertPageNum : 1,
	expertHasNext : null,
	resource_id : '',
	resource_name : '',
	currentScore : 0,
	allCommentDiv : null,
	goodCommentDiv : null,
	middleCommentDiv : null,
	negativeCommentDiv : null
};
$(function(){
	globalVar.expertHasNext = '${shareExpertNext}';
	globalVar.resource_id = '${resource.resource_id}';
	globalVar.resource_name = '${resource.file_name}';
	globalVar.allCommentDiv = $('#tab3001');
	globalVar.goodCommentDiv = $('#tab3002');
	globalVar.middleCommentDiv = $('#tab3003');
	globalVar.negativeCommentDiv = $('#tab3004');
	//globalVar.expertPageNum = 1;
	loadComments();
	$.ajax({
		 url : '/share/resource/resourceViewAjax/${resource.resource_id}',
      	 dataType : 'text',
      	 success : function(d,status){},
      	 error : function(d){}
	});
	$('#d_r_now').click(function(){
		downResource();
	});
	$('#publish_comment_a').click(function(){
		publishComment();
	});
});
function commentStarLevel(level){
	globalVar.currentScore = level;
}
function publishComment(){
	var $comment = $('#comment_input');
	var commentText = $comment.val();
	$.ajax({
		 url : '/share/resource/getHeadImg/0/null',
		 type : 'post',
 	   	 dataType : 'json',
 	   	 success : function(d,status){
 	   		 var data = {
 	   			 referenceId : "${resource.share_file_id}",
 				 content : commentText,
 				 author : {"identity":d.uid, "name":d.uname},
 				 commentType : 'resource',
 				 score : globalVar.currentScore
 			 };
 	   		doPublishComment(data,d.himg);
 	   	 },
 	   	 error : function(d){}
	});	
}
//执行发布评论
function doPublishComment(data,himg){
	$.ajax({
		 url : '/api/v1/comment',
		 type : 'post',
		 contentType : 'application/json',
		 headers: {
            "Accept" : "text/plain; charset=utf-8",
            "Content-Type": "application/json; charset=utf-8"
        },
		 data : JSON.stringify(data),
	   	 //dataType : 'json',
	   	 success : function(d,status){
	   		 //alert(d);
	   		 $('#comment_input').val('');
	   		 var commentData = {
	   			_id : d,
	   			author : {"identity": data.author.identity,"name": data.author.name},
	   			content : data.content,
	   			score : data.score,
	   			createTime : {$date:new Date().format('yyyy-MM-dd hh::mm::ss')}
	   		 };
	   		appendComment(commentData,true,himg);
	   		//appendComment(d,data.author.identity,data.author.name,himg,data.score,data.content,new Date().format('yyyy-MM-dd hh::mm::ss'),true,null);
	   	 },
   	 	error : function(d){}
	});
}
//往评论列表增加评论
function appendComment(commentData,first,authorHImg){
	var _id = commentData._id;
	var authorid= commentData.author.identity;
	var authorName = commentData.author.name;
	var score = commentData.score;
	var html = '<div class="tab30001" name="commentContainer-'+_id+'">'+
			'<div class="tab30002"> <img src="${image.server}/images/user02.jpg" name="headImg-'+_id+'"> </div>'+
		 	'<div class="tab30003">'+
			'<div class="tab3040102">'+
				'<div class="tab3040103"> <a href="#"><span class="retext05">'+commentData.author.name+'</span></a>给课程打了'+commentData.score+'分'+
					'<div class="tab304010301"> <a href="javascript:void(0);" name="replyBut-'+_id+'" style="color:#2884b3;">回复</a> </div>'+
				'</div>'+
				'<div class="tab3040104"> '+commentData.content+'</div>'+
				'<div class="tab3040105"> '+commentData.createTime.$date+' </div>'+
			'</div></div></div>';
	 if(first) globalVar.allCommentDiv.prepend(html); else globalVar.allCommentDiv.append(html);
	 globalVar.allCommentDiv.find('a[name=replyBut-'+_id+']').click(function(){ replyCommentEvent(1,_id,_id,authorid,authorName);  });
	 fillReplyComments(1,_id,commentData.comments);
	 
	 //根据score判断插入的div
	 if(score <= 2){//差评
		 if(first) globalVar.negativeCommentDiv.prepend(html); else globalVar.negativeCommentDiv.append(html);
		 globalVar.negativeCommentDiv.find('a[name=replyBut-'+_id+']').click(function(){ replyCommentEvent(2,_id,_id,authorid,authorName);  });
	 } else if(score >2 && score <= 6){//中评
		 if(first) globalVar.middleCommentDiv.prepend(html); else globalVar.middleCommentDiv.append(html);
		 globalVar.middleCommentDiv.find('a[name=replyBut-'+_id+']').click(function(){ replyCommentEvent(3,_id,_id,authorid,authorName);  });
	 } else if(score >6 && score <= 10){//好评
		 if(first) globalVar.goodCommentDiv.prepend(html); else globalVar.goodCommentDiv.append(html);
		 globalVar.goodCommentDiv.find('a[name=replyBut-'+_id+']').click(function(){ replyCommentEvent(4,_id,_id,authorid,authorName);  });
	 }
	if(authorHImg != null && authorHImg != ''){
		$('img[name=headImg-'+_id+']').attr('src','${drmFilePath}cdrmimg/'+authorHImg+'?w=50&h=50');
	} else {
		$.ajax({
			 url : '/share/resource/getHeadImg/'+authorid+'/'+_id,
			 type : 'post',
	  	   	 dataType : 'json',
	  	   	 success : function(d,status){
	  	   		 //alert('get head'+d.himg);
	  	   		 if(d.himg != ''){
	  	   		$('img[name=headImg-'+d.comment_id+']').attr('src','${drmFilePath}cdrmimg/'+d.himg+'?w=50&h=50');
	  	   		 }
	  	   	 },
	  	   	 error : function(d){}
		});
	}
}
//填充回复的评论列表
function fillReplyComments(type,_id,replyComments){
	var $container = getPanelDivByType(type);
	var $commentDiv = $container.find('div[name=commentContainer-'+_id+'] .tab30003');
	//alert('1' == 1);
	if(replyComments){
		$.each(replyComments,function(i,item){
			$commentDiv.append('<div class="tab305">'+
							'<div class="tab3050101"> <img src="${image.server}/images/user02.jpg" name="headImg-'+item._id+'"> </div>'+
							'<div class="tab3050102">'+
								'<div class="tab3050103"> <a href="#"><span class="retext05">'+item.author.name+'</span></a>回复 <a href="#"><span class="retext05">'+item.object.name+'</span></a>'+
									'<div class="tab305010301"> <a href="javascript:void(0);" onclick="replyCommentEvent(\''+type+'\',\''+_id+'\',\''+item._id+'\',\''+item.author.identity+'\',\''+item.author.name+'\')" name="replyBut-'+item._id+'" style="color:#2884b3;">回复</a> </div>'+
								'</div>'+
								'<div class="tab3050104">'+item.content+'</div>'+
								'<div class="tab3050105">'+item.createTime.$date+'</div>'+
							'</div>'+
						'</div>');
			$.ajax({
				 url : '/share/resource/getHeadImg/'+item.author.identity+'/'+item._id,
				 type : 'post',
		  	   	 dataType : 'json',
		  	   	 success : function(d,status){
		  	   		 //alert('get head'+d.himg);
		  	   		 if(d.himg != ''){
		  	   			$('img[name=headImg-'+d.comment_id+']').attr('src','${drmFilePath}cdrmimg/'+d.himg+'?w=50&h=50');
		  	   		 }
		  	   	 },
		  	   	 error : function(d){}
			});
		});
	}
}
// 加载评论列表
function loadComments(){
	$.ajax({
		 url : '/api/v1/comment/host/${resource.share_file_id}?type=resource',
		 type : 'get',
	   	 success : function(d,status){
	   		 //alert(d);
	   		 var data = $.parseJSON(d);
	   		 //var html = [];
	   		 $.each(data,function(i,item){
	   			//appendComment(item._id,item.author.identity,item.author.name,null,item.score,item.content,item.createTime.$date,false,item.comments);
	   			appendComment(item,false,null);
	   		 });
	   		 //$('#tab3001').append(html.join(''));
	   	 },
	   	 error : function(d){}
	});
}
//根据type得到页签
function getPanelDivByType(type){
	var $container;
	if(type == 1) $container=globalVar.allCommentDiv;
	else if(type == 2) $container=globalVar.goodCommentDiv;
	else if(type == 3) $container=globalVar.middleCommentDiv;
	else if(type == 4) $container=globalVar.negativeCommentDiv;
	return $container;
}
//回复点击事件
function replyCommentEvent(type,hostid,_id,authorid,authorName){
	//alert('replyCommentEvent');
	var $container = getPanelDivByType(type);	
	var $replyDiv = $container.find('[name=replyDiv-'+_id+']');
	/*if($replyDiv.length > 0){
		$replyDiv.each(function(){
		  $(this).val("");
		 });
		$replyDiv.show();
	} else */
	if($replyDiv.length < 1){
		$container.find('[name=commentContainer-'+hostid+']').append('<div class="tab30004" name="replyDiv-'+_id+'" style="display:block">'+
					'<input type="text" style="width:590px;height:70px;padding:0px;" id="replyInput-'+_id+'">'+
					'<a href="javascript:void(0);" onclick="doReplyComment(\''+type+'\',\''+hostid+'\',\''+_id+'\',\''+authorid+'\',\''+authorName+'\')" name="replyBut-'+_id+'">'+
					'<div class="tab30005"> 发&nbsp;表 </div>'+
					'</a> </div>');
		var $inputs = $("div[name^='replyDiv-'][name!=replyDiv-"+_id+"]");
		//alert($inputs.length);
		$inputs.remove();
	}
}
function doReplyComment(type,hostid,_id,authorid,authorName){	 
	var $input = $('#replyInput-'+_id);
	var commentText = $input.val();
	$.ajax({
		 url : '/share/resource/getHeadImg/0/null',
		 type : 'post',
	   	 dataType : 'json',
	   	 success : function(d,status){
	   		 //alert(JSON.stringify(d));
	   		 var data = {
	   			 referenceId : hostid,
				 content : commentText,
				 author : {"identity":d.uid, "name":d.uname},
				 commentType : 'resource',
				 object : {"identity":authorid, "name":authorName}
			  };
	   		 //alert(data.author.identity);
	   		 var replyAuthorName = d.uname;
	   		 var replyAuthorId = d.uid;
	   		 var replyHImg = d.himg;
	   		 $.ajax({
		   		 url : '/api/v1/comment',
		   		 type : 'post',
		   		 contentType : 'application/json',
		   		 headers: {
		               "Accept" : "text/plain; charset=utf-8",
		               "Content-Type": "application/json; charset=utf-8"
		           },
		   		 data : JSON.stringify(data),
		      	 //dataType : 'json',
		      	 success : function(d,status){
		      		// alert('success:'+d);
		      		var $replyDiv = $('div[name=replyDiv-'+_id+']');
		      		showReply(type,authorName,replyAuthorId,replyAuthorName,commentText,hostid,d,replyHImg);
		      		//$input.remove();
		      		$replyDiv.remove();
		      		 //var data = JSON.parseJSON(d);
		      	 },
		      	 error : function(d){}
		   	});
	   	 },
	   	 error : function(d){}
	});	
}
function showReply(type,author,replyAuthorId,reviewer,content,hostid,_id,himg){
	var $container = getPanelDivByType(type);
	var html='<div class="tab305">'
			+'	<div class="tab3050101"> <img src="${drmFilePath}cdrmimg/'+himg+'?w=50&h=50'+'"> </div>'
			+'	<div class="tab3050102">'
			+'		<div class="tab3050103"> <a href="#"><span class="retext05">'+reviewer+'</span></a>回复 <a href="#"><span class="retext05">'+author+'</span></a>'
			+'			<div  class="tab305010301"> <a style="color:#2884b3;" onclick="replyCommentEvent(\''+type+'\',\''+hostid+'\',\''+_id+'\',\''+replyAuthorId+'\',\''+reviewer+'\')" name="replyBut-'+_id+'">回复</a> </div>'
			+'		</div>'
				+'	<div class="tab3050104"> '+content+' </div>'
			+'		<div class="tab3050105">'+ new Date().format('yyyy-MM-dd hh:mm:ss');+' </div>'
			+'	</div>'
		+'	</div>';
	//$('[name='+namediv+']').append(html); 
	var $tmp = $container.find('div.tab30003');
	$tmp.append(html);
	//$container.find('div[name=commentContainer-'+hostid+'] .tab30003').append(html);
}
//下载资源
function downResource(){
	$.ajax({
		 url : '/share/resource/valid_integral/'+globalVar.resource_id,
     	 dataType : 'json',
     	 success : function(d,status){
     		 if(d.can){
     			 window.open("/drmdown/${resource.file_id}?fnm="+globalVar.resource_name);
     		 } else {
     			 alert(d.msg);
     		 }
     	 },
     	 error : function(d){}
	});
}
function expertNext(){
	//alert(globalVar.expertHasNext);
	var $table = $('#share_expert_table');
	if(globalVar.expertHasNext == 'true'){
		$.ajax({
			 url : '/share/resource/expertListAjax/'+(globalVar.expertPageNum + 1),
	       	 dataType : 'json',
	       	 success : function(d,status){
	       		 var html = [];
	       		 $.each(d.shareExpertList,function(i,item){
	       			html.push('<tr height="70px">'+
	       					'<td width="60px"> <a href="#"><img src="${drmFilePath}cdrmimg/'+item.user_himg+'?w=50&h=50" ></a> </td>'+
	       					'<td  valign="top"> <a href="#" ><p class="retext05">'+item.user_lnm+'</p></a> 综合积分：'+item.user_integral+' </td></tr>');
	       		 });
	       		 //alert(html.join(''));
	       		$table.html(html.join(''));
	       		globalVar.expertPageNum ++;
	       		 //alert(d.shareExpertNext);
	       		 globalVar.expertHasNext = d.shareExpertNext;
	       	 },
	       	 error : function(d){
	       		 alert('请求出错！');
	       	 }
		});
	} else {
		$table.html('无更多数据');
	}
}
function testReply(){
	var data = {
  			 referenceId : "${resource.share_file_id}",
			 content : "sssssSSSSSSS",
			 author : {"identity":"1920209339393939393", "name":"name"},
			 commentType : 'resource',
			 object : {"identity":"23644eb8-ed19-4c65-b8d8-827c26241efd", "name":"ddddddddd"}
		 };
  		$.ajax({
	   		 url : '/api/v1/comment',
	   		 type : 'post',
	   		 contentType : 'application/json',
	   		 headers: {
	               "Accept" : "text/plain; charset=utf-8",
	               "Content-Type": "application/json; charset=utf-8"
	           },
	   		 data : JSON.stringify(data),
	      	 //dataType : 'json',
	      	 success : function(d,status){
	      		 alert('success:'+d);
	      		 //$('#replyDiv-'+_id).hide();
	      		 var data = JSON.parseJSON(d);
          alert(data);
	      	 },
	      	 error : function(d){}
	   	});

}
</script>
</body>
</html>